package payroll.trans;

import java.util.LinkedHashMap;
import java.util.Map;

import payroll.Employee;
import payroll.Paycheck;
import payroll.PayrollDatabase;
import payroll.Transaction;

public class PaydayTransaction implements Transaction {

	private Map<Integer,Paycheck> paychecks = new LinkedHashMap<Integer,Paycheck>();
	
	@Override
	public void execute() {
		for (Employee e : PayrollDatabase.listAllEmployees()) {
			Paycheck p = e.pay();
			paychecks.put(e.getEmpId(),p);
		}
	}

	public Paycheck getPaycheckOf(int empId) {
		return paychecks.get(empId);
	}

}
